home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / chkbook / mainfrm.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  2.7 KB  |  109 lines

  1. // MainFrm.cpp : implementation of the CMainFrame class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1999 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13. #include "stdafx.h"
  14. #include "chkbook.h"
  15. #include "chkbkdoc.h"
  16.  
  17. #include "MainFrm.h"
  18.  
  19. #ifdef _DEBUG
  20. #define new DEBUG_NEW
  21. #undef THIS_FILE
  22. static char THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CMainFrame
  27.  
  28. IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
  29.  
  30. BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
  31.     //{{AFX_MSG_MAP(CMainFrame)
  32.     ON_WM_CREATE()
  33.     //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CMainFrame construction/destruction
  38.  
  39. CMainFrame::CMainFrame()
  40. {
  41. }
  42.  
  43. CMainFrame::~CMainFrame()
  44. {
  45. }
  46.  
  47. BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
  48. {
  49.     return CFrameWnd::PreCreateWindow(cs);
  50. }
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CMainFrame diagnostics
  54.  
  55. #ifdef _DEBUG
  56. void CMainFrame::AssertValid() const
  57. {
  58.     CFrameWnd::AssertValid();
  59. }
  60.  
  61. void CMainFrame::Dump(CDumpContext& dc) const
  62. {
  63.     CFrameWnd::Dump(dc);
  64. }
  65.  
  66. #endif //_DEBUG
  67.  
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CMainFrame message handlers
  70.  
  71.  
  72. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
  73. {
  74.     if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
  75.         return -1;
  76.  
  77. #if defined(_WIN32_WCE_PSPC) 
  78.     if(!m_wndCommandBar.Create(this) ||
  79.        !m_wndCommandBar.InsertMenuBar(IDR_MAINFRAME) ||
  80.        !m_wndCommandBar.AddAdornments() ||
  81.        !m_wndCommandBar.LoadToolBar(IDR_MAINFRAME))
  82.     {
  83.         TRACE0("Failed to create CommandBar\n");
  84.         return -1;      // fail to create
  85.     }
  86. #elif(_WIN32_WCE > 200)
  87.     if(!m_wndCommandBar.Create(this) ||
  88.        !m_wndCommandBar.InsertMenuBar(IDR_MAINFRAME) ||
  89.        !m_wndCommandBar.InsertSeparator(6) || 
  90.        !m_wndCommandBar.LoadToolBar(IDR_MAINFRAME) ||
  91.        !m_wndCommandBar.AddAdornments())
  92.     {
  93.         TRACE0("Failed to create CommandBar\n");
  94.         return -1;      // fail to create
  95.     }
  96. #else // MFC for Windows CE 1.0 and 2.0
  97.     int nNumButtons = sizeof(g_arCBButtons)/sizeof(TBBUTTON);
  98.     if(!InsertButtons(g_arCBButtons, nNumButtons, IDR_MAINFRAME, 4) ||
  99.        !AddAdornments(0))
  100.     {
  101.         TRACE0("Failed to create CommandBar\n");
  102.         return -1;      // fail to create
  103.     }
  104. #endif
  105.  
  106.     return 0;
  107. }
  108.  
  109.